using UnityEngine;

public class ChangeColorOnClick : MonoBehaviour
{
    private Renderer rend;
    private Color[] colors = { Color.red, Color.blue, Color.green, Color.yellow };
    private int currentColorIndex = 0;

    void Start()
    {
        rend = GetComponent<Renderer>();
    }

    void OnMouseDown()
    {
        currentColorIndex = (currentColorIndex + 1) % colors.Length;
        rend.material.color = colors[currentColorIndex];
    }
}
